import { ApiTags } from '@nestjs/swagger/dist';
import { Controller, Get, Post, Body, Patch, Param, Delete, Query } from '@nestjs/common';
import { NewCarClueService } from './new-car-clue.service';
import { CreateNewCarClueDto } from './dto/create-new-car-clue.dto';
import { UpdateNewCarClueDto } from './dto/update-new-car-clue.dto';

@ApiTags('新车线索')
@Controller('newcarclue')
export class NewCarClueController {
  constructor(private readonly newCarClueService: NewCarClueService) {}


  @Post()
  async create(@Body() createNewCarClueDto: CreateNewCarClueDto) {
    return await this.newCarClueService.create(createNewCarClueDto);
  }

  @Get()
  async findAll() {
    return await this.newCarClueService.findAll();
  }

  @Get('page')
  async findPage(@Query() query: any) {
    return await this.newCarClueService.findPage(query)
  }

  @Get(':id')
  async findOne(@Param('id') id: string) {
    return await this.newCarClueService.findOne(id);
  }

  @Patch(':id')
  async update(@Param('id') id: string, @Body() updateNewCarClueDto: UpdateNewCarClueDto) {
    return await this.newCarClueService.update(id, updateNewCarClueDto);
  }

  @Delete(':id')
  async remove(@Param('id') id: string) {
    return await this.newCarClueService.remove(id);
  }

  @Post('delMany')
  manyRemove(@Body() body: string[]) {
    return this.newCarClueService.manyRemove(body)
  }

  @Post('/date/:id')
  changeDate(@Param('id') id: string, @Body() dto: {date: string}) {
    return this.newCarClueService.changeLockDate(id, dto)
  }
}
